<template>
	<view class="my-prizepage">
		<view class="pagebox">
			<image class="bj" :src="imgurl+'/WeChat/pagebj.png'" mode="scaleToFill"></image>
			<view class="prize-list">
				<view class="prize-item" v-for="(item,k) in cardList" :key="k">
					<view class="prize-good">
						<image :src="imgurl+(item.prize_url||'/WeChat/pic6.png')" mode="aspectFit" />
					</view>
					<view class="goods-name">
						{{item.prize_name}}
					</view>
					<view class="prize_username flex-between">
						<!-- <text>小明</text> -->
						<text>{{item.create_time}}</text>
					</view>
					<view class="dhm">
						兑换码：{{item.code_num}}
					</view>
					<view class="ts">
						{{item.msg}}
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgurl: this.serverURL,
				cardList: [],
				isauthorized: (uni.getStorageSync('token') ? true : false),
				userinfo: {
					id: 0,
					username: '-',
					avatar: '',
					level: '',
					score: '',
					nowDayNum: 0,
					nowDayRice: '0',
					Company: 'm'
				},
			};
		},
		onReady() {
			this.isauthorized = (uni.getStorageSync('token') ? true : false)
			if (uni.getStorageSync('token')) {
				this.userinfo = uni.getStorageSync('token');
			}
			this.getDrawDate()
		},
		methods: {
			getDrawDate() {
				let that = this;
				uni.request({
					url: that.serverURL + "/index/Draw/getUserPrize",
					method: "POST",
					data: {
						id: that.userinfo['id'],
					},
					success(res) {
						that.cardList = res.data
						console.log(that.cardList)
					},
					fail(fail) {
						uni.hideLoading();
					}
				});
			}
		}
	}
</script>

<style lang="less">
	.my-prizepage {
		position: fixed;
		top: 0px;
		left: 0px;
		height: 100%;
		width: 100%;
		padding: 47rpx 35rpx;
		box-sizing: border-box;

	}

	.pagebox {
		width: 100%;
		height: 100%;
		position: relative;
		border-radius: 20rpx;
		overflow: hidden;

		.prize-list {
			position: absolute;
			top: 0px;
			left: 0px;
			width: 100%;
			height: 95%;
			z-index: 2;
			padding: 1px 60rpx;
			box-sizing: border-box;
			overflow-y: scroll;
		}

		.bj {
			position: absolute;
			top: 0px;
			left: 0px;
			width: 100%;
			height: 100%;
			z-index: 1;
		}

		.prize-item {
			width: 565rpx;
			margin: 30rpx auto;
			background: #fff;
			border-radius: 30rpx;
			padding: 40rpx;
			box-sizing: border-box;
			line-height: 50rpx;

		}
	}

	.prize-list {
		position: relative;
		z-index: 2;
	}

	.prize-good {
		width: 430rpx;
		height: 430rpx;
		margin: 0px auto;
	}

	.goods-name {
		font-weight: bold;
		margin-bottom: 10rpx;
	}

	.dhm {
		color: #666;
	}

	.ts {
		color: #666;
	}
</style>
